﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using SH.Client.WPF.View;

namespace SH.Client.WPF
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Context is disposed when app exits.")]
    public partial class App : Application
    {
        /// <summary>
        /// The unit of work co-ordinating changes for the application
        /// </summary>
        //public ModelContainer context;

        /// <summary>
        /// Lauches the entry form on startup
        /// </summary>
        /// <param name="e">Arguments of the startup event</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            
            //NOTE: If there is not a Microsoft SQL Server Express instance available at .\SQLEXPRESS 
            //      you will need to update the "Storehause" connection string in App.config
            base.OnStartup(e);
            {
                // установка соединения
                //Database.SetInitializer(new MigrateDatabaseToLatestVersion<ModelContainer, Configuration>());
                //context = new ModelContainer();
                //context.Database.Initialize(false);
            }
            //var window = new MainWindow();

            //window.test = new test();

            //var query = from vis in context.Statuses
            //            select vis;

            //window.test.Sta = query.ToList();

            //window.DataContext = window.test;
            //window.Show();
        }

        /// <summary>
        /// Cleans up any resources on exit
        /// </summary>
        /// <param name="e">Arguments of the exit event</param>
        protected override void OnExit(ExitEventArgs e)
        {
            //context.Dispose();

            base.OnExit(e);
        }
    }
}
